<template>
  <div class="app-container">
    <RouterView />
  </div>
</template>

<script setup>
import { RouterView } from 'vue-router'
import { onMounted, onUnmounted } from 'vue'

// 添加清除本地存储的函数
const clearLocalStorage = () => {
  // 清除委托相关的存储项
  localStorage.removeItem('historyDelegations')
  localStorage.removeItem('pickupHistory')
  
  // 清除聊天相关的存储项
  localStorage.removeItem('chat_messages')
  localStorage.removeItem('chat_conversations')
  localStorage.removeItem('message_read_status')
}

// 在页面关闭或刷新时清除数据
const handleBeforeUnload = () => {
  clearLocalStorage()
}

onMounted(() => {
  window.addEventListener('beforeunload', handleBeforeUnload)
})

onUnmounted(() => {
  window.removeEventListener('beforeunload', handleBeforeUnload)
  clearLocalStorage() // 组件卸载时也清除数据
})
import './assets/font.css'
</script>

<style>
/* 重置所有默认样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  color: #ffffff;
  font-family: 'SourceHanFont', sans-serif;
}

/* 重置html和body的样式 */
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #ffffff;
  font-family: 'SourceHanFont', sans-serif;
}

/* 应用容器样式 */
.app-container {
  width: 100%;
  height: 100%;
  background: #ffffff;
  overflow: hidden;
}

#app {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
</style>